<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>

<script type="text/javascript">
    var equobj;
    var did;
    $(function() {
        $('#eqaddtypeid').combobox({
            url : '${path }/equipmenttype/eqtype',
            panelHeight : 'auto',
            required : true,
            valueField:'id',
            textField:'equipmenttypename'
        });
        $('#eqaddbrand').combobox({
            url : '${path }/brand/eqbrand',
            panelHeight : 'auto',
            required : true,
            valueField:'id',
            textField:'brandname'
        });
        $('#eqaddorgid').combotree({
            url : '${path }/org/orgTree',
            lines : true,
            panelHeight : 'auto',
            valueField:'id',
            textField:'text',
            onChange: function (newValue, oldValue) {
                var url= '${path }/org/getdepartmentlist?id='+newValue;
                $('#eqaddusedepartmentid').combobox('reload',url);
            }


        });


        //var oid=$('#userEditorganizationId').combotree("getValue");

        $('#eqaddusedepartmentid').combobox({
            url : '',
            panelHeight : 'auto',
            valueField:'id',
            textField:'name',
            onChange: function (newValue, oldValue) {
                var url= '${path }/user/selectUsersSimpleListByDepId?id='+newValue;
                $('#eqadduserid').combobox('reload',url);


            }

        });


        $('#eqadduserid').combobox({
            url : '',
            panelHeight : 'auto',

            required : true,
            valueField:'id',
            textField:'realname'



        });

        $('#equAddForm').form({
            url : '${path }/equipmentdetail/add',

            onSubmit : function() {
                progressLoad();

                var isValid = $(this).form('validate');

                if (!isValid) {
                    progressClose();
                }

                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });

    });

</script>

        <form id="equAddForm" method="post" style="margin:0; padding:10px 30px;" >
            <input type="hidden" name="id" id="id"/>
            <div class="form_item">
                <label style="display:inline-block; width:80px;">设备名:</label>
                <input type="text" name="eqname" class="easyui-textbox"   style="margin-bottom:5px;"/>
            </div>
            <div class="form_item">
                <label style="display:inline-block;    width:80px;">设备类型:</label>

                <select id="eqaddtypeid" name="eqtypeid" style="width: 160px;"  class="easyui-combobox"  ></select>
            </div>
            <div class="form_item">
                <label style="display:inline-block;    width:80px;">设备编号:</label>
                <input type="text" name="eqnumber" style="margin-bottom:5px;" class="easyui-textbox"  />
            </div>
            <div class="form_item">
                <label style="display:inline-block;    width:80px;">设备串号:</label>
                <input type="text" name="eqsn" style="margin-bottom:5px;" class="easyui-textbox"  />
            </div>

            <div class="form_item">
                <label style="display:inline-block;    width:80px;">设备品牌:</label>

                <select id="eqaddbrand" name="eqaddbrand" style="width: 160px;"  class="easyui-combobox"  ></select>
            </div>
            <div class="form_item">
                <label style="display:inline-block;    width:80px;">设备所属单位:</label>
                <select id="eqaddorgid" name="eqorgid"  style="width: 160px;"  class="easyui-combotree" ></select>
            </div>
            <div class="form_item">
                <label style="display:inline-block;    width:80px;">设备使用部门:</label>

                <select id="eqaddusedepartmentid" name="equsedepartmentid" style="width: 160px;"  class="easyui-combobox"  ></select>
            </div>
            <div class="form_item">
                <label style="display:inline-block; width:80px;" >使用人:</label>

                <select id="eqadduserid" name="equserid" style="width: 160px;"  class="easyui-combobox"  ></select>
            </div>
            <div class="form_item">
                <label style="display:inline-block; width:80px;">产品型号:</label>
                <input type="text" name="eqproductmodel" style="margin-bottom:5px;" class="easyui-textbox"  />
            </div>

            <div class="form_item">
                <label style="display:inline-block; width:80px;">购买日期:</label>
                <input type="text" name="eqbuydate" style="margin-bottom:5px;" class="easyui-datetimebox"/>
            </div>
            <div class="form_item">
                <label style="display:inline-block; width:80px;">使用时间:</label>
                <input type="text" name="equseddate" style="margin-bottom:5px;" class="easyui-datetimebox"/>
            </div>
            <div class="form_item">
                <label style="display:inline-block; width:80px;">设备状态:</label>

                <select id="eqstate" name="eqstate" class="easyui-combobox" data-options="width:160,editable:false,panelHeight:'auto'">
                    <option value="0">正常</option>
                    <option value="1">停用</option>
                </select>
            </div>
            <div class="form_item">
                <label style="display:inline-block; width:80px;">设备用途:</label>
                <input type="text" name="equseby" style="margin-bottom:5px;" class="easyui-textbox"  />
            </div>
            <div class="form_item">
                <label style="display:inline-block; width:80px;">设备维保到期日:</label>
                <input type="text" name="eqsafeguard" style="margin-bottom:5px;" class="easyui-datetimebox"/>
            </div>
            <div class="form_item">
                <label style="display:inline-block; width:80px;">配注:</label>
                <input type="text" name="eqremarks" style="margin-bottom:5px;" class="easyui-textbox"  />
            </div>
 </form>
